<template>
    <button
            :class="{'cur':type===curMethod}"
            @click="changeMethod"
    >{{val}}
    </button>
</template>
<script>
    export default {
        name: "CalButton",
        props: {
            val: String,
            type: String,
            curMethod: String
        },
        data() {
            return {}
        },
        methods: {
            changeMethod() {
                this.$emit("dispatch", 'CHANGE_METHOD', this.type)
            }
        }
    }
</script>
<style scoped>
    button {
        margin: 10px;
        cursor: pointer;
    }

    .cur {
        background-color: orange;
        color: #fff;
    }
</style>
